<?php

namespace Common\Model;

use Think\Model;

class Order
{

    /**
     * @param array $row
     *
     * [
     * 'id'=>1,
     * 'user_id'=>11,
     * 'member_id'=>11,
     * 'movie_id'=>11,
     * 'screening_id'=>11,
     * 'price'=>11.22,
     * ....
     * ]
     *
     */
    public function load(array $row)
    {
        foreach ($row as $key => $value) {
            $this->$key = $value;
            // $this->id = 1;
            // $this->user_id = 11;
            // $this->movie_id = 111;
        }
    }

    /**
     * 返回订单关联的电影数据
     * @return array
     */
    public function getMovie()
    {
        return M('Movie')->where(array('id' => $this->movie_id))->find();
    }

}